package com.example.news.repository

import com.example.news.entity.BaseEntity
import com.example.news.http.RetrofitManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import retrofit2.http.Query

class NewsRepository {

    val apiService by lazy { RetrofitManager.getApiService() }

    suspend fun getNewsList(type:Int, page:Int)=flow<BaseEntity>{
        emit(apiService.getNewsList(type, page))
    }.flowOn(Dispatchers.IO)
}